<?php


namespace App\Request\api;


use App\Request\CommonRequest;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class MessageRequest extends CommonRequest
{
    protected $name = '聊天消息验证';

    protected $rule = [
        'getAllFriendTalkList' => [
            'pageNum' => 'required',
            'pageSize' => 'required',
        ],
        'getFriendTalkList' => [
            'pageNum' => 'required',
            'pageSize' => 'required',
            'marketUserId' => 'required',
            'traceNo' => 'required',
        ],
        'getMessageTalkList' => [
            'pageNum' => 'required',
            'pageSize' => 'required',
            'marketUserId' => 'required',
            'userId' => 'required',
            'isRoomMsg' => 'required',
        ],
        'getOperationSendMessage' => [
            'content' => 'required|max:255',
            'traceNo' => 'required|max:255',
            'sendId' => 'required|max:255',
            'receiverId' => 'required|max:255',
            'isRoomMsg' => 'required',
        ],
        'getOperationSendImage' => [
            'fullPath' => 'required|max:255',
            'path' => 'required|max:255',
            'type' => 'required|max:5',
            'traceNo' => 'required|max:255',
            'sendId' => 'required|max:255',
            'receiverId' => 'required|max:255',
            'isRoomMsg' => 'required',
        ],
        'getFriendSendMessage' => [
            'content' => 'required|max:255',
            'msgType' => 'required|max:5',
            'sendId' => 'required|max:255',
            'receiverId' => 'required|max:255',
            'isRoomMsg' => 'required',
        ],
        'getNewMessageTalk' => [
            'marketUserId' => 'required|max:255',
            'userId' => 'required|max:255',
            'isRoomMsg' => 'required',
            'traceNo' => 'required',
        ]

    ];

    protected $message = [
        'content.required' => '消息内容不能为空',
        'traceNo.required' => '对话编号不能为空',
        'sendId.required' => '发送方编号不能为空',
        'receiverId.required' => '接收方编号不能为空',
        'isRoomMsg.required' => '是否是群消息不能为空',
        'type.required' => '消息类型不能为空',
        'path.required' => '文件路径不能为空',
        'fullPath.required' => '文件全路径不能为空',
        'msgType.required' => '消息类型不能为空',
        'pageNum.required' => '当前页数不能为空',
        'pageSize.required' => '每页条数不能为空',
        'marketUserId.required' => '账号编号不能为空',
        'userId.required' => '接收用户编号不能为空',
    ];


    /**
     * 验证
     * @param array $params
     * @param string $scenes
     * @return bool
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function validated(array $params, string $scenes): bool
    {
        return $this->__validated($params, $scenes);
    }
}